// 例子45

class Point {
    constructor(x, y) {
        this.x = x;
        this.y = y;
    }
}

class ColorPoint extends Point {
    constructor(x, y, color) {
        try {
            this.color = color; // Uncaught ReferenceError: Must call super constructor in derived class before accessing 'this' or returning from derived constructor
        } catch(e) {
            console.error(e)
        }

        super(x, y);
        this.color = color; // 正确
    }
}
let p = new ColorPoint(1, 2, 'red');
console.log(p);